<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>Geeklog Documentation - Static Pages Plugin</title>
  <link rel="stylesheet" type="text/css" href="../docstyle.css" title="Dev Stylesheet">
</head>

<body>
<p><a href="http://www.geeklog.net/" style="background:transparent"><img src="../images/newlogo.gif" alt="Geeklog" width="243" height="90"></a></p>
<div class="menu"><a href="index.html">Geeklog Documentation</a> - Static Pages Plugin</div>

<h1>Static Pages plugin</h1>

<h2><a name="about">What is it?</a></h2>

<p>The Static Pages plugin was originally aimed at creating pages with static content (as opposed to the dynamic pages created by Geeklog) - hence the name. Pages like an "about us" page, a mission statement, etc. would come to mind.</p>

<p>Since then, people have used the static pages for all kinds of things and with the inclusion of PHP into static pages, even the original name isn't quite right any more ...</p>


<h2><a name="features">Features</a></h2>

<ul>
  <li>supports <a href="#php">use of PHP</a></li>
  <li><a href="#id">editable page ID</a> to make more readable URLs</li>
  <li>Static pages can be displayed on Geeklog's <a href="#frontpage">index and topic pages</a> and can even replace it entirely ("splash screen")</li>
  <li>"<a href="#cloning">cloning</a>" of existing pages</li>
  <li>Makes use of Geeklog's <a href="#url">URL rewrite feature</a></li>
  <li>Provides <a href="#autotags">two autotags</a></li>
  <li>proper support for Geeklog permissions</li>
</ul>


<h2><a name="php">Use of PHP</a></h2>

<h3><a name="activation">Activating PHP</a></h3>

<p><strong>Important:</strong> For security reasons, the use of PHP in static pages is disabled by default. To enable it, you will have to grant the 'staticpages.PHP' permission to the "Static Page Admin" group. To do this, log in as the Admin and from the Admin's Only block, select "Groups". Find the "Static Page Admin" group and edit it by clicking on the name of the group. At the bottom of the page, you will find a list of "Rights" (permissions) that can be granted to all members of this group. Note that 'staticpages.delete' and 'staticpages.edit' are checked, while 'staticpages.PHP' is not checked. To allow members of the Static Page Admin group to use PHP in static pages, you will have to check the 'staticpages.PHP' checkbox and save your changes.</p>

<p>In addition to the 'staticpages.PHP' permission discussed above, there is also a global option to disable the use of PHP in static pages entirely. That option ("Allow PHP?") can be found in the Configuration admin panel for the static pages plugin. When set to "False", that option will override the 'staticpages.PHP
' permission and disable all use of PHP in static pages.</p>

<h3><a name="usage">Usage</a></h3>

<p style="text-align:center"><em>The use of PHP in static pages may result in security issues if not used properly. Use this feature with care!</em></p>

<p>The use of PHP has to be enabled for each individual static page. Below the content edit field, you will find a drop-down menu with the following options:</p>
<ul>
<li>do not execute PHP<br>
Obivously, when you select this option, any PHP code in the static page will <em>not</em> be executed but will instead be printed out as-is.</li>
<li>execute PHP (return)<br>
If you select this option, PHP code in static pages <em>will</em> be executed. The 'return' indicates that the code should return any output it generates, using a PHP <code>return</code> statement, instead of printing it out directly. This is the PHP option as introduced with the Static Pages plugin 1.3.</li>
<li>execute PHP<br>
Again, this option <em>will</em> enable execution of PHP. Only this time, the PHP code can actually use <code>echo</code> and <code>print</code> statements without having the output interfere with the page layout.</li>
</ul>

<p>Please note that when embedding PHP code in a static page, your code should <em>not</em> be enclosed in the PHP <code>&lt;?php</code> and <code>?&gt;</code> tags. Instead, it is assumed that the static page contains the PHP code that would normally go <em>between</em> those two tags.</p>

<p>When selecting the second of the above PHP execution options ("execute PHP") you can, however, switch back and forth between PHP and plain HTML like this:</p>
<pre style="padding-left: 2em"><code>echo "Hello"; ?&gt;, &lt;b&gt;world&lt;/b&gt;, &lt;?php echo "how are you?";</code></pre>
<p>The above example would print out "Hello, <b>world</b>, how are you?".</p>


<h2><a name="id">Page ID</a></h2>

<p>When creating a new static page, it will be assigned a page ID automatically. This ID consists of the date and time and up to three random digits. When you anticipate that the URL of this page may be used a lot, e.g. quoted in emails, it may make sense to use a more readable ID for the page.</p>

<p>The static pages editor will let you change the page ID. For example, you may want to rename the ID for your "about" page from "20030313100131123" to "about", thus creating a URL like</p>

<p style="margin-left:4em;"><tt>http://yoursite/staticpages/index.php?page=about</tt></p>

<p>which looks much nicer when quoted (and is easier to remember). You could further improve this by making use of Geeklog's <a href="#url">URL rewrite feature</a>.</p>

<p>Please note that you should only use letters and digits for the page ID. Avoid national special characters, most punctuation characters ('-' and '.' should be okay, though) and spaces. The static page editor will catch some illegal characters but not all of them ...</p>


<h2><a name="frontpage">Using Static Pages on the index page</a></h2>

<p>Geeklog's Center Blocks concept allows plugins to place blocks in the center area of a Geeklog site, i.e. among the stories.</p>

<p>When you check the "Centerblock" option for a static page, you can use the "Position" and "Topic" drop-downs to chose where this static page will be displayed. For "Position", the options are "Top Of Page", "After Featured Story", "Bottom Of Page" (which should be self-explanatory) and "Entire Page". That last option, "Entire Page", will tell Geeklog that this static page will replace the entire index page - it will not display any stories, but only the contents of this static page. This is useful e.g. for "splash" screens or Welcome pages.</p>

<p><strong>Tip:</strong> When using a static page as a "splash" screen, you may need a link that takes your visitors to the normal index page, i.e. the list of current stories. To do this, create a link to <code>index.php?display=all</code></p>

<p>The second drop-down, "Topic", lets you restrict the display of a static page to only a certain topic, the homepage only, or all pages (i.e. all topic pages and the homepage). This is the same as the options you have for blocks.</p>

<p><strong>Tip:</strong> You can combine these options with the permission settings. This will let you, for example, create a "welcome" page that is only displayed to anonymous users.</p>

<h3><a name="sort">Sorting</a></h3>

<p><strong>Centerblocks:</strong> When you have more than one static page that would appear in the same section of the center area (e.g. two static pages that would be displayed at the top of the index page), you can choose the order in which they appear from the Configuration admin panel for the static pages plugin. Your options are:</p>
<ul>
<li>Date (sort by last changed date)</li>
<li>Page ID (sort by the page id; default)</li>
<li>Page Title (sort by the page title)</li>
</ul>
<p>Please note that this order will only apply to centerblocks from static pages. All other plugins creating centerblocks will not be in that order. Also note that the centerblock is not necessarily looking like a standard Geeklog block. To achieve that, please check the field "Wrapping Static Pages in a block" below.</p>

<p><strong>Menu entries:</strong> It's also possible to sort the static pages that are displayed in the site's menu (if you're using a theme that uses the <code>{plg_menu_elements}</code> variables in its <tt>header.thtml</tt>). This sort order can also be changed in the Configuration admin panel for the static pages plugin:</p>
<ul>
<li>Date (sort by last changed date)</li>
<li>Label (sort by the menu label text; default)</li>
<li>Page ID (sort by the page id)</li>
<li>Page Title (sort by the page title)</li>
</ul>


<h2><a name="block">Wrapping Static Pages in a block</a></h2>

<p>You can chose to have a static page wrapped in a Geeklog block-layout by checking the "wrap static page in a block" option in the static pages editor. If selected, the page's title will be used as the block title. Further, you can, as with normal blocks, enter a help URL. If this URL is entered, the block will display a help icon linking to that URL.</p>

<p>The default for this option can be set in the Configuration admin panel for the static pages plugin.</p>


<h2><a name="cloning">Cloning Static Pages</a></h2>

<p>When you have a lot of similar static pages you may want to make a copy of an existing page and then edit that copy. This can easily be done by clicking on the [C] from the list of static pages. Doing so will create a copy of that page with a new page ID.</p>


<h2><a name="url">URL rewriting</a></h2>

<p style="text-align:center"><em>Please note that this feature is considered experimental and is known not to work with IIS.</em></p>

<p>Geeklog supports a form of URL rewriting, i.e. change the look of URLs such that they are more search engine friendly. For example, instead of</p>

<p style="margin-left:4em;"><tt>http://yoursite/staticpages/index.php?page=20030313100131123</tt></p>

<p>the URL could look like this</p>

<p style="margin-left:4em;"><tt>http://yoursite/staticpages/index.php/20030313100131123</tt></p>

<p>Some search engines are known not to index pages when the URL includes characters like '?' and '='. You could further improve the chances of this page being indexed by <a href="#id">replacing the numeric page ID</a> with a word or expression (preferrably something that corresponds to the page's content), e.g.</p>

<p style="margin-left:4em;"><tt>http://yoursite/staticpages/index.php/about</tt></p>

<p>To make use of URL rewriting, you will need to set the option "Enable URL Rewriting" to True in Geeklog's Configuration admin panel.</p>

<h2><a name="delete">Deleting pages with their owner</a></h2>

<p>As all objects in Geeklog, static pages have an owner (the user that created the static page). When that user's account is deleted for some reason, any static pages owned by that user can either be deleted as well or they can be assigned to another user in Geeklog's Root group.</p>

<p>In the Configuration admin panel for the static pages plugin, you can set the "<a href="#desc_delete_pages">Delete Pages with Owner?</a>" option to either "False" (which is also the default), meaning that static pages will not be deleted withtheir owner, but assigned to a member of the Root group instead (the user withthe lowest user ID, most likely the Admin). Setting the option to "True" means that static pages will be deleted when their owner's account is deleted.</p>

<h2><a name="config.php">Configuration</a></h2>

<p>The configuration options for the Static Pages plugin can be changed from
the Configuration admin panel:</p>

<h3><a name="main">Static Pages Main Settings</a></h3>

<table>
<tr><th style="width:25%">Variable</th>
    <th style="width:25%">Default Value</th>
    <th style="width:50%">Description</th>
</tr>
<tr>
  <td><a name="desc_allow_php">allow_php</a></td>
  <td>true</td>
  <td>Allows you to globally allow or disallow the <a href="#php">use of PHP</a>
    in static pages, i.e. it overrides the setting on individual pages.</td>
</tr>
<tr class="r2">
  <td><a name="desc_sort_by">sort_by</a></td>
  <td>'id'</td>
  <td>Define sort order when more than one static page is displayed in
    centerblocks. Allows sorting by page ID, page title, and date of last
    change.</td>
</tr>
<tr>
  <td><a name="desc_sort_menu_by">sort_menu_by</a></td>
  <td>'label'</td>
  <td>Define sort order for static pages in the site's menu. Allows sorting by
    page label, page ID, page title, and date of last change.</td>
</tr>
<tr class="r2">
  <td><a name="desc_delete_pages">delete_pages</a></td>
  <td>false</td>
  <td>Specify what should happen to a static page when its owner (i.e. the user
    who created the page) is deleted. 'True' would delete the page, 'False'
    will assign it to a user in the "Root" group (usually the user with the
    lowest user ID).</td>
</tr>
<tr>
  <td><a name="desc_in_block">in_block</a></td>
  <td>true</td>
  <td>Whether to display the content of static pages inside a block template or
    not. This is the default setting and can be overridden per page.</td>
</tr>
<tr class="r2">
  <td><a name="desc_show_hits">show_hits</a></td>
  <td>true</td>
  <td>Whether to show the number of hits for a static page.</td>
<tr>
<tr>
  <td><a name="desc_show_date">show_date</a></td>
  <td>true</td>
  <td>Whether to show the date and time of the last change to a static page.</td>
</tr>
<tr class="r2">
  <td><a name="desc_filter_html">filter_html</a></td>
  <td>false</td>
  <td>Whether HTML in static pages should be run through Geeklog's HTML filter
    option.</td>
</tr>
<tr>
  <td><a name="desc_censor">censor</a></td>
  <td>false</td>
  <td>Whether the content of the static page should be run through Geeklog's
    "bad words" filter.</td>
</tr>
<tr class="r2">
  <td><a name="desc_aftersave">aftersave</a></td>
  <td>'list'</td>
  <td>Which page to go to after a static page has been saved:
    <ul>
    <li>'item': display the page</li>
    <li>'list': show admin's list of static pages (default)</li>
    <li>'home': display the site's homepage</li>
    <li>'admin': go to the "Admin Home" page, i.e. Command &amp; Control</li>
    </ul></td>
</tr>
<tr>
  <td><a name="desc_atom_max_items">atom_max_items</a></td>
  <td>10</td>
  <td>Max. number of static pages returned when an Atom feed is requested
    through the webservices API.</td>
</tr>
<tr class="r2">
  <td><a name="desc_meta_tags">meta_tags</a></td>
  <td>false</td>
  <td>Whether to include the meta tags of the staticpage when it is displayed.</td>
</tr>
</table>

<h3><a name="whatsnew">What's New Block</a></h3>

<table>
<tr><th style="width:25%">Variable</th>
    <th style="width:25%">Default Value</th>
    <th style="width:50%">Description</th>
</tr>
<tr>
  <td valign="top"><a name="desc_newstaticpagesinterval">newstaticpagesinterval</a></td>
  <td valign="top">1209600</td>
  <td valign="top">Static pages are "new" if they are this many seconds old.</td></tr>
<tr class="r2">
  <td valign="top"><a name="desc_hidenewstaticpages">hidenewstaticpages</a></td>
  <td valign="top">false</td>
  <td valign="top">Set to true to hide new static pages from the What's New block.</td></tr>
<tr>
  <td valign="top"><a name="desc_title_trim_length">title_trim_length</a></td>
  <td valign="top">20</td>
  <td valign="top">Max. length of the title of items listed in the What's New block.</td></tr>
<tr class="r2">
  <td valign="top"><a name="desc_includecenterblocks">includecenterblocks</a></td>
  <td valign="top">false</td>
  <td valign="top">Set to true to include static pages that are displayed as a center block.</td></tr>
<tr>
  <td valign="top"><a name="desc_includephp">includephp</a></td>
  <td valign="top">false</td>
  <td valign="top">Set to true to include static pages that execute PHP.</td></tr>
</table>


<h3><a name="search">Search Results</a></h3>

<table>
<tr><th style="width:25%">Variable</th>
    <th style="width:25%">Default Value</th>
    <th style="width:50%">Description</th>
</tr>
<tr>
  <td valign="top"><a name="desc_includesearch">includesearch</a></td>
  <td valign="top">true</td>
  <td valign="top">Set to true to enable static pages in search results.</td></tr>
<tr class="r2">
  <td valign="top"><a name="desc_includesearchcenterblocks">includesearchcenterblocks</a></td>
  <td valign="top">false</td>
  <td valign="top">Set to true to include static pages that are displayed as a center block.</td></tr>
<tr>
  <td valign="top"><a name="desc_includesearchphp">includesearchphp</a></td>
  <td valign="top">false</td>
  <td valign="top">Set to true to include static pages that execute PHP.</td></tr>
</table>


<h2><a name="autotags">Autotags</a></h2>

<p>The Static Pages Plugin provides 2 <a href="http://www.geeklog.net/article.php/autolinks" title="geeklog.net: About Autolinks and Autotags">autotags</a>,
<code>[staticpage:]</code> and <code>[staticpage_content:]</code>.</p>

<ul>
<li>The <code>[staticpage:]</code> autotag will provide a link to a static page.
    Simply add the page's ID after the colon. By default, the title of the
    static page will be used as the link text. You can provide your own link
    text after the page ID (but before the closing bracket).</li>
<li>The <code>[staticpage_content:]</code> autotag will be replaced with the
    contents of the static page in question. This can be useful when you need
    to use a piece of text in more than one place.</li>
</ul>

<div class="footer">
    <a href="http://wiki.geeklog.net/">The Geeklog Documentation Project</a><br>
    All trademarks and copyrights on this page are owned by their respective owners. Geeklog is copyleft.
</div>
</body>
</html>
